function filter(data) {
  const allData = [{ headItem: [], dataItem: [] }]
  if (data && data.pageInfo && data.pageInfo.list.length > 0) {
    let headData = [] // 头部区域名称
    const datas = [] // 对应数据
    const dataList = data.pageInfo.list
    // 先去重拿到所有区域
    headData = dataList.map(function(item, index) {
      return item.xzqhmc
    })
    // headData = [...new Set(headData)]
    headData = headData.filter(function(item, index) {
      return headData.indexOf(item, 0) === index
    })

    const type1 = dataList.filter(function(item) { return item.zbid === 'L1' })
    const type2 = dataList.filter(function(item) { return item.zbid === 'L2' })
    const type3 = dataList.filter(function(item) { return item.zbid === 'L3' })
    const type4 = dataList.filter(function(item) { return item.zbid === 'L4' })
    const type5 = dataList.filter(function(item) { return item.zbid === 'L5' })
    const type6 = dataList.filter(function(item) { return item.zbid === 'L6' })
    const type7 = dataList.filter(function(item) { return item.zbid === 'L7' })
    const tyeps = []
    tyeps.push(type1, type2, type3, type4, type5, type6, type7)

    // 分别创建对应的7个地区小学、初中的值
    const ageData = []
    const xxTurnList = []
    const czTurnList = []
    const era = { male: [], female: [] }
    for (let i = 0; i < tyeps.length; i++) {
      ageData.push(era)
    }

    tyeps.forEach(function(item, index) {
      const xxdata = item.filter(function(idx) { return idx.xdxx === '2' })
      const czdata = item.filter(function(idx) { return idx.xdxx === '3' })
      // 判断与补充是否出现 小学 区域缺漏
      if (xxdata.length === 0) {
        headData.forEach(function(m, mindex) {
          xxdata.push({ zbdbl: 0, xzqhmc: m })
        })
      } else {
        headData.forEach(function(mc, mcindex) {
        	if (headData[mcindex] !== xxdata[mcindex].xzqhmc) {
            xxdata.splice(mcindex, 0, { zbdbl: 0, xzqhmc: mc })
          }
      	 })
      }
      // 判断与补充是否出现 初中 区域缺漏
      if (czdata.length === 0) {
        headData.forEach(function(czm, czmindex) {
          czdata.push({ zbdbl: 0, xzqhmc: czm })
        })
      } else {
        headData.forEach(function(czmc, czmcindex) {
        	if (headData[czmcindex] !== czdata[czmcindex].xzqhmc) {
            czdata.splice(czmcindex, 0, { zbdbl: 0, xzqhmc: czmc })
          }
      	 })
      }
      xxTurnList.push(xxdata)
      czTurnList.push(czdata)
      // 向对应datas传值
      // xxdata.forEach(function(xx, xxidx) {
      //  ageData[index + 1].male.push(xx.zbdbl)
      // })
      // czdata.forEach(function(cz, czidx) {
      //  ageData[index + 1].female.push(cz.zbdbl)
      // })
    })

    tyeps.forEach(function(item, index) {
      const navItem = {
        year: 'L' + (index + 1),
        age_data: {
          male: [],
          female: []
        }
      }
      xxTurnList[index].forEach(function(xxTurnItem, xxidx) {
        navItem.age_data.male.push(xxTurnItem.zbdbl)
      })
      czTurnList[index].forEach(function(czTurnItem, czidx) {
        navItem.age_data.female.push(czTurnItem.zbdbl)
      })
      datas.push(navItem)
    })

    allData[0].headItem = headData
    allData[0].dataItem = datas
    return allData
  } else {
    return allData
  }
}
